// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import FastClick from 'fastclick'
import router from '@/router'
import App from './App'
import store from './store'
import * as wechatAPI from '@/server/api/wechat'
import { LoadingPlugin, AlertPlugin, ConfirmPlugin, WechatPlugin } from 'vux'
import VueScroller from 'vue-scroller'

Vue.use(VueScroller)
Vue.use(LoadingPlugin)
Vue.use(AlertPlugin)
Vue.use(ConfirmPlugin)
Vue.use(WechatPlugin)

FastClick.attach(document.body)

Vue.config.productionTip = false

const wx = Vue.wechat
const url = document.location.href
wechatAPI.fetchSign(encodeURIComponent(url.split('#')[0])).then(r => {
  wx.config(r)
  wx.ready(function () {
    wx.onMenuShareTimeline({
      title: '丽水市机动车驾驶员培训学校', // 分享标题
      link: 'http://app.lssqx.com', // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
      imgUrl: 'http://app.lssqx.com/logo.jpg'
    })
    wx.onMenuShareAppMessage({
      title: '丽水市机动车驾驶员培训学校', // 分享标题
      desc: '丽水市公安汽校创建于1986年，2006年更名为丽水市机动车驾驶员培训学校有限公司', // 分享描述
      link: 'http://app.lssqx.com', // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
      imgUrl: 'http://app.lssqx.com/logo.jpg'
    })
  })
})

/* eslint-disable no-new */
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app-box')
